<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/**
 * Description of banner_model
 * 
 * @author Subha Sundar Das (subhasundar.das@gmail.com)
 */
class Email_template_model extends CI_Model {

//------------------Get all templates---------------------
    function get_templates() {
        if (!$this->db->table_exists('email_template')) {
            return FALSE;
        }
        $sql = "select * from email_template order by id";
        $query = $this->db->query($sql);
        $result = $query->result();
        return $result;
    }

//------------------Get template by id---------------------
    function get_template($id=0) {
        if ($id) {
            $sql = "select * from email_template  where id=$id order by id";
            $query = $this->db->query($sql);
            $result = $query->row();
            return $result;
        }
    }

//------------------Update a templates---------------------
    function update_template($description=NULL,$id=0, $status=NULL) {
        $sql = "update email_template set description='$description', status='$status' where id=$id";
        $this->db->query($sql);
    }

}